import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ChartRight from '../components/chat/chatRight.vue'
import headerRight1 from '../components/header/headerRight1.vue'
import headerRight2 from '../components/header/headerRight2.vue'
import headerRight3 from '../components/header/headerRight3.vue'




Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/homeView/1'

  },
  {
    path: '/homeView',
    name: 'homeView',
    component: HomeView,
    children:[
      {
        path:'1',
        component:headerRight1
      },{
        path:'2',
        component:headerRight2
      },{
        path:'3',
        component:headerRight3
      },{
      path:'4',
      component:ChartRight
    }]
    // component: ChartRight
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
